Skip to content

do not surround first key with brackets#16

Open
PavloBilyak wants to merge 1 commit into
mskubenich:masterfrom
PavloBilyak:master
Open

do not surround first key with brackets#16
PavloBilyak wants to merge 1 commit into
mskubenich:masterfrom
PavloBilyak:master

Conversation

@PavloBilyak

Copy link
Copy Markdown

Description

It seems that due to an oversight in the try_api form key builder, the first argument is always wrapped in brackets, so user[id] becomes [user][id]. This pull request removes the wrapping of the first key, restoring compatibility with newer Rails versions. This change should not affect previous versions, as the updated behavior was expected.

Background

In a recent Rails version (somewhere between 7.1.4 and 7.1.4.2), the way form arguments are parsed was changed. Specifically, if the first part of a key is surrounded by brackets (e.g., [user][id] or [user_id]), it will be parsed as-is instead of being lifted as before.

For example, form data with a key named [user][id] will be parsed as {"[user]": { "id": 1 }} instead of {"user": { "id": 1 }}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant